package org.vineatoum.view;

import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.util.ArrayList;

public class BasicTransferable implements Transferable {
	Object o ;
	ArrayList<DataFlavor> df = new ArrayList();
	
	public BasicTransferable(Object o) {
		super();
		this.o = o;
		this.df.add(new DataFlavor( o.getClass(),
				   DataFlavor.javaJVMLocalObjectMimeType));
	}

	@Override
	public Object getTransferData(DataFlavor arg0)
			throws UnsupportedFlavorException, IOException {
		// TODO Auto-generated method stub
		return o;
	}

	@Override
	public DataFlavor[] getTransferDataFlavors() {
		// TODO Auto-generated method stub
		return (DataFlavor[]) df.toArray();
	}

	@Override
	public boolean isDataFlavorSupported(DataFlavor arg0) {
		// TODO Auto-generated method stub
		return df.contains(arg0);
	}

}
